home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-11-06 | 24.3 KB | 1,028 lines | [TEXT/MPS ] |
-
- ;*******************************************************
- ;
- ; Develop Code Samples.
- ;
- ; Written by Matt Gulick. Started October 16,1990
- ;
- ;*******************************************************
-
- ;*******************************************************
- ;
- ; This file contains the code samples that are used in
- ; the Scanning From ProDOS article in DEVELOP. These
- ; code segments may be used freely by anyone. All
- ; code in this file assumes that we are running in an
- ; 8 bit Apple IIe.
- ;
- ;*******************************************************
-
- ;*******************************************************
- ;
- ; Revision History:
- ;
- ;*******************************************************
-
- ; Oct 16, 1990 File started.
- ;
-
- STRING PASCAL
- BLANKS OFF
- PAGESIZE 70
- PRINT NOGEN
- PRINT NOMDIR
- MACHINE M65C02
-
- EJECT
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #1
- ;
- ; This first code segment walks the slots starting at
- ; slot 7, looking first for a card of any kind. Once
- ; found, we check the ID bytes for a Smartport card.
- ; Once found we check the ID Type byte to see if it is
- ; a SCSI Card. If it passes all these tests, we then
- ; issue a Device $00 Status $00 call to further ensure
- ; that this is the Apple High-Speed SCSI Card.
- ;
- ;*******************************************************
-
- ;
- ; The following are Equates
- ; that will bee used in all
- ; the Sample Code Segments
- ; that follow.
- ;
- slot_7 equ $C7
- slot_1 equ $C1
-
- My_ZPage equ $42
-
- KBD equ $C000 ;Keyboard
- CLR80VID equ $C00C ;Disable 80-column hardware
- SET80VID equ $C00D ;Enable 80-column hardware
- KBD_STRB equ $C010 ;Keyboard Strobe
- RD80COL equ $C018 ;Read 80 Col. Mode
- RDTEXT equ $C01A ;Read Text Mode
- RDMIX equ $C01B ;Read Mix Mode
- RDPAGE2 equ $C01C ;Read Page 2 setting
- RDHIRES equ $C01D ;Read HiRes setting
- TXTCLR equ $C050 ;Clear Text Mode
- TXTSET equ $C051 ;Set Text Mode
- MIXCLR equ $C052 ;Clear Mixed Mode
- MIXSET equ $C053 ;Set Mixed Mode
- TXTPAGE1 equ $C054 ;Set Text Page 1
- TXTPAGE2 equ $C055 ;Set Text page 2
- LORES equ $C056 ;Set LoRes Graphics
- HIRES equ $C057 ;Set HiRes Graphics
- CLRAN3 equ $C05E ;Clear annunciator 3
- SETAN3 equ $C05F ;Set annunciator 3
-
- ESC equ $9B ;High bit set ASCII ESC Key
-
- Blk_sig1 equ $01
- Blk_sig2 equ $03
- Blk_sig3 equ $05
- SPort_sig equ $07
- SPort_ID equ $FB
-
- Ext_SPort equ %10000000 ;Bit 7
- SCSI equ %00000010 ;Bit 2
-
- No_Err equ $00
- IO_Err equ $27
- No_dev equ $28
-
- ;*******************************************************
-
- EXPORT P8_Scanner
- P8_Scanner PROC
- ;
- ; Main Code Segment.
- ;
-
- jsr find_card
- jsr find_scanr
- jsr htone_filter
- jsr def_window
- jsr start_scan
- jsr get_data
- jsr display
- bcc P8_Scanner
- rts
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #1
- ;
- ; This first code segment walks the slots starting at
- ; slot 7, looking first for a card of any kind. Once
- ; found, we check the ID bytes for a Smartport card.
- ; Once found we check the ID Type byte to see if it is
- ; a SCSI Card. If it passes all these tests, we then
- ; issue a Device $00 Status $00 call to further ensure
- ; that this is the Apple High-Speed SCSI Card.
- ;
- ;*******************************************************
-
- find_card
- ;
- ; Save the current Zero
- ; Page values before
- ; using them.
- ;
- lda <My_ZPage
- pha
- lda <My_ZPage+1
- pha
- ;
- ; Start at Slot 7.
- ;
- lda #slot_7
- sta <My_ZPage+1 ;Zero Page
- sta slot+1 ;For Safe keeping
- stz <My_ZPage
- stz slot
- ;
- ; Is it a Smartport Card?
- ;
- @chk_smart ldy #Blk_sig1
- lda (My_ZPage),y;Block_device Signature Byte
- cmp #$20 ;#1 = $20
- bne @next_slot
-
- ldy #Blk_sig2
- lda (My_ZPage),y;Block_device Signature Byte
- bne @next_slot ;#2 = $00
-
- ldy #Blk_sig3
- lda (My_ZPage),y;Block_device Signature Byte
- cmp #$03 ;#3 = $03
- bne @next_slot
-
- ldy #SPort_sig
- lda (My_ZPage),y;SmartPort Signature Byte
- bne @next_slot ;#1 = $00
- ;
- ; We have a Smartport
- ; Device. Is it SCSI with
- ; Extended SmartPort?
- ;
- ldy #SPort_ID
- lda (My_ZPage),y
- and #Ext_SPort+\
- SCSI
- cmp #Ext_SPort+\
- SCSI
- bne @next_slot
- ;
- ; Is it an Apple High-
- ; Speed SCSI Card?
- ;
- jsr is_it_appl
- bcc @exit
- ;
- ; Check the Next Slot.
- ;
- @next_slot lda <My_ZPage+1
- dec a
- sta <My_ZPage+1
- sta slot+1
- cmp #slot_1
- bge @chk_smart
- lda #No_dev ;No Device Error
- ;
- ; Clean Exit
- ;
- @exit tax
- pla
- sta <My_ZPage+1
- pla
- sta <My_ZPage
- txa
-
- cmp #$01 ;Set Carry if Non-Zero
- rts
- ;
- ; This routine determines
- ; if the card is the new
- ; High-Speed SCSI Card.
- ;
- is_it_appl ldy #$ff
- lda (My_ZPage),y
- clc
- adc #$03 ;Set Smartport Entry Address
- sta card_ntry
-
- lda <My_ZPage+1
- sta card_ntry+1
-
- jsr call_card
- dc.b $00 ;Status Call Command Number
- dc.w stat_list1
- ;
- ; Check the Results
- ;
- lda stat_data+2 ;Low Byte of Vendor ID
- cmp #$01 ;Must be $01
- bne @non_apple
-
- lda stat_data+3 ;High Byte of Vendor ID
- bne @non_apple ;Must be $00
-
- lda stat_data+4 ;Low Byte of Version
- bne @non_apple ;Should be Null
-
- lda stat_data+5 ;High Byte of Version
- bne @non_apple ;Should be Null
-
- clc ;Acc. 0 by previous LDA
- bra @done
-
- @non_apple lda #No_dev ;Device not found.
- sec
- ;
- ; Restore ZPage
- ;
- @done pha
- php
- lda slot
- sta <My_ZPage
- lda slot+1
- sta <My_ZPage+1
- plp
- pla
- rts
-
- slot dc.w $0000
-
- ;*******************************************************
-
- call_card jmp (card_ntry)
-
- card_ntry dc.w $0000
-
- ;*******************************************************
-
- stat_list1 dc.b $03 ;PCount = 3
- dc.b $00 ;Device = Card
- dc.w stat_data ;Data returned here
- dc.b $00 ;Get Host Status Call
-
- ;*******************************************************
-
- stat_data dcb.b 64,0 ;Our Buffer.
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #2
- ;
- ; This code segment walks the unit numbers from the
- ; SCSI Card starting at unit 2 and going to unit 0 to
- ; get the actual unit number count. Once this is
- ; done, we start at unit 1 and walk forward until we
- ; find the scanner.
- ;
- ;*******************************************************
-
- find_scanr
- ;
- ; First we issue a
- ; Status call to device
- ; number 2. This will
- ; force the card to
- ; build its tables if it
- ; has not yet done so.
- ;
- lda #$02
- sta dev_num2
- stz stat_code2
-
- jsr call_card
- dc.b $00
- dc.w stat_list2
- bcs @error
- ;
- ; Now call Unit 0 to
- ; find out the total
- ; device count.
- ;
- stz dev_num2
- jsr call_card
- dc.b $00 ;Status Call Command Number
- dc.w stat_list2
- bcs @error
-
- lda stat_data2 ;Get the Total Device
- sta dev_count ;Count
-
- lda #$03 ;Set up for DIB Status
- sta stat_code2 ;Calls
-
- @loop lda dev_num2 ;First time we increment
- cmp dev_count ;a zero giving a device
- bge @error ;number of 1.
-
- inc dev_num2
- jsr call_card
- dc.b $00 ;Status Call Command Number
- dc.w stat_list2
- bcs @error
-
- lda d_type
- cmp #$08 ;Is it Type = Scanner?
- bne @loop ;No.
-
- lda d_stype
- cmp #$A0 ;Subtype = $A0?
- bne @loop ;No
- ;
- ; Scan string is a Pascal
- ; String. A length byte
- ; followed by ASCII. We
- ; want to make sure they
- ; are both the same length
- ; as well as the same text.
- ;
- ldx id_str_len
- @str_loop lda id_str_len,x
- cmp scan_str,x
- bne @loop
- dex
- bne @str_loop
-
- lda dev_num2 ;We have our Scanner
- sta scan_dnum
- lda #No_Err
- clc
- rts
-
- @error lda #No_dev ;Device not found.
- sec
- rts
-
- ;*******************************************************
-
- scan_str dc.b 'APPLE SCANNER ' ;4 Spaces between
- ;1 Sace after
- dev_count dc.b $00
-
- ;*******************************************************
-
- scan_dnum dc.b $00 ;Scanner Device Number
-
- ;*******************************************************
-
- stat_list2 dc.b $03 ;PCount = 3
- dev_num2 dc.b $00 ;Device number
- dc.w stat_data2 ;Data returned here
- stat_code2 dc.b $00 ;Status Code
-
- ;*******************************************************
-
- stat_data2 ;Our Buffer. Used over.
- d_stat dc.b $00 ;Device Status Byte
- blk_low dc.b $00 ;Block Count (Low)
- blk_mid dc.b $00 ;Block Count (Mid)
- blk_hi dc.b $00 ;Block Count (High)
- id_str_len dc.b $00 ;ID String Length
- id_str dcb.b 16,$00 ;ID STring (16 Bytes)
- d_type dc.b $00 ;Device Type
- d_stype dc.b $00 ;Device Subtype
- d_version dc.w $00 ;Version Word
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #3
- ;
- ; This code segment issues an Apple Scanner SEND
- ; Command by using the Apple SCSI Card Generic SCSI
- ; call ($2B). By so doing we can send our halftone
- ; filter to the Scanner.
- ;
- ;*******************************************************
-
- htone_filter
- ;
- ; Issue the Call
- ;
- lda scan_dnum
- sta dev_num3
-
- jsr call_card
- dc.b $04 ;Control Call Command Number
- dc.w cmd_list3
- rts
-
- ;*******************************************************
-
- cmd_list3 dc.b $03 ;PCount = 3
- dev_num3 dc.b $04 ;Device number
- dc.w filter_data ;Pointer to data
- dc.b $2B ;Control Code
-
- ;*******************************************************
-
- filter_data ;Our Data
- dc.w 24 ;Total Length of Parms
- dc.l send_fltr ;CDB Pointer (Long)
- dc.l DCData3 ;DCMove Ptr (Long)
- dc.l $00000000 ;Rqst Sense Ptr (Long)
- dc.b $00 ;Reserved
- dc.b $00 ;SCSI Status
- dc.b $00 ;Command Count
- dc.l $00000011 ;Trans Count (Long)
- dc.b $00 ;DMA Mode
- dc.l $00000000 ;Reserved (Long)
-
- ;*******************************************************
-
- send_fltr dc.b $2A ;Scanner SEND Command
- dc.b $00 ;Reserved
- dc.b $02 ;Transfer Type
- dc.b $00 ;Reserved
- dc.b $00 ;Reserved
- dc.b $02 ;Transfer ID Byte
- dc.b $00 ;Reserved
- dc.b $00 ;Transfer Length (High)
- dc.b $11 ;Transfer Length (Low)
- dc.b $00 ;Reserved
-
- ;*******************************************************
-
- DCData3 dc.l send_data ;Scanner SEND Data Ptr
- dc.l $00000011 ;Transfer Count
- dc.l $00000000 ;Offset
- dc.l $00000000 ;Reserved
-
- dc.l $00000000 ;DCStop
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
-
- ;*******************************************************
-
- send_data dc.b $44 ;4 X 4 Matrix Size
- dc.b $08 ;Pel 0
- dc.b $88 ;Pel 1
- dc.b $28 ;Pel 2
- dc.b $A8 ;Pel 3
- dc.b $C8 ;Pel 4
- dc.b $48 ;Pel 5
- dc.b $E8 ;Pel 6
- dc.b $68 ;Pel 7
- dc.b $38 ;Pel 8
- dc.b $B8 ;Pel 9
- dc.b $18 ;Pel 10
- dc.b $98 ;Pel 11
- dc.b $F8 ;Pel 12
- dc.b $78 ;Pel 13
- dc.b $D8 ;Pel 14
- dc.b $58 ;Pel 15
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #4
- ;
- ; This code segment issues an Apple Scanner Define
- ; Window Parameters Command by using the Apple SCSI
- ; Card Generic SCSI call ($2B). This command defines
- ; the area of the scanner glass we want to scan
- ;
- ;*******************************************************
-
- def_window
- ;
- ; Issue the Call
- ;
- lda scan_dnum
- sta dev_num4
-
- jsr call_card
- dc.b $04 ;Control Call Command Number
- dc.w cmd_list4
- rts
-
- ;*******************************************************
-
- cmd_list4 dc.b $03 ;PCount = 3
- dev_num4 dc.b $00 ;Device number
- dc.w def_wndo ;Pointer to data
- dc.b $2B ;Control Code
-
- ;*******************************************************
-
- def_wndo ;Our Data
- dc.w 24 ;Total Length of Parms
- dc.l def_wnd_cmd ;CDB Pointer (Long)
- dc.l DCData4 ;DCMove Ptr (Long)
- dc.l $00000000 ;Rqst Sense Ptr (Long)
- dc.b $00 ;Reserved
- dc.b $00 ;SCSI Status
- dc.b $00 ;Command Count
- dc.l 8+40 ;Trans Count (Long)
- dc.b $00 ;DMA Mode
- dc.l $00000000 ;Reserved (Long)
-
- ;*******************************************************
-
- def_wnd_cmd dc.b $24 ;Scanner Define Window
- ;Parameters Command
- dc.b $00 ;Reserved
- dc.b $00 ;Reserved
- dc.b $00 ;Reserved
- dc.b $00 ;Reserved
- dc.b $00 ;Reserved
- dc.b $00 ;Transfer Length (High)
- dc.b $00 ;Transfer Length (Mid)
- dc.b 8+40 ;Transfer Length (Low)
- dc.b $80 ;Apple Bit
-
- ;*******************************************************
-
- DCData4 dc.l wndo_data ;Scanner Window Data Ptr
- dc.l 8+40 ;Transfer Count
- dc.l $00000000 ;Offset
- dc.l $00000000 ;Reserved
-
- dc.l $00000000 ;DCStop
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
-
- ;*******************************************************
- ; NOTE: Remember that all values that are longer than
- ; 1 byte are in reversed order from natice 65xxx code.
- ;*******************************************************
-
- wndo_data dcb.b 6,$00 ;Reserved
- dc.b $00 ;Transfer Length (High)
- dc.b 40 ;Transfer Length (Low)
-
- dc.b $01 ;Window Identifier
- dc.b $00 ;Reserved
-
- dc.b $00 ;X Resolution (High)
- dc.b 75 ;X Resolution (Low)
-
- dc.b $00 ;Y Resolution (High)
- dc.b 75 ;Y Resolution (Low)
- ;
- ; We will use the corner as
- ; Our Upper Left Possition.
- ; This is at coordinate 0,0
- ;
- dc.b $00 ;Upper Left X (High)
- dc.b $00 ;Upper Left X (Mid High)
- dc.b $00 ;Upper Left X (Mid Low)
- dc.b $00 ;Upper Left X (Low)
-
- dc.b $00 ;Upper Left Y (High)
- dc.b $00 ;Upper Left Y (Mid High)
- dc.b $00 ;Upper Left Y (Mid Low)
- dc.b $00 ;Upper Left Y (Low)
- ;
- ; Width is defined as the number
- ; of 1/1200-inch increments on
- ; the horizontal axis; must be on
- ; a byte boundry for both the
- ; start and end points. We will
- ; set for 4 Inches and drop the
- ; extra.
- ;
- dc.b $00 ;Width (High)
- dc.b $00 ;Width (Mid High)
- dc.b 4*1200/256 ;Width (Mid Low)
- dc.b 4*1200 ;Width (Low)
- ;
- ; Length is defined as the number
- ; of 1/1200-inch increments on the
- ; vertical axis. We want ≈ 2 1/2
- ; inches or 3072 increments
- ;
- dc.b $00 ;Length (High)
- dc.b $00 ;Length (Mid High)
- dc.b 3072/256 ;Length (Mid Low)
- dc.b 3072 ;Length (Low)
-
- dc.b $80 ;Median Brightness
- dc.b $80 ;Median Threshold
- dc.b $80 ;Median Contrast
-
- dc.b $01 ;Image Composition (Halftone)
- dc.b $01 ;Bits per Pixel
-
- dc.b $00 ;Halftone Mask Always $00 (High)
- dc.b $02 ;Downloaded Mask Pattern (Low)
-
- dc.b $03 ;Padding Type
- dcb.b 2,$00 ;Reserved
- dc.b $00 ;Compression Type (None)
- dcb.b 7,$00 ;Scanner Ref. is wrong. Says 5.
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #5
- ;
- ; This code segment issues an Apple Scanner SCAN
- ; Command by using the Apple SCSI Card Generic SCSI
- ; call ($2B). This starts the actual scanning.
- ;
- ;*******************************************************
-
- start_scan
- ;
- ; Issue the Call
- ;
- lda scan_dnum
- sta dev_num5
-
- jsr call_card
- dc.b $04 ;Control Call Command Number
- dc.w cmd_list5
- rts
-
- ;*******************************************************
-
- cmd_list5 dc.b $03 ;PCount = 3
- dev_num5 dc.b $00 ;Device number
- dc.w scan_cmd ;Pointer to data
- dc.b $2B ;Control Code
-
- ;*******************************************************
-
- scan_cmd ;Our Data
- dc.w 24 ;Total Length of Parms
- dc.l do_scan ;CDB Pointer (Long)
- dc.l DCData5 ;DCMove Ptr (Long)
- dc.l $00000000 ;Rqst Sense Ptr (Long)
- dc.b $00 ;Reserved
- dc.b $00 ;SCSI Status
- dc.b $00 ;Command Count
- dc.l $00000001 ;Trans Count (Long)
- dc.b $00 ;DMA Mode
- dc.l $00000000 ;Reserved (Long)
-
- ;*******************************************************
-
- do_scan dc.b $1B ;SCAN
- ;Parameters Command
- dcb.b 3,$00 ;Reserved
- dc.b 1 ;Transfer Length (Low)
- dc.b $00 ;Wait and Home Bits = 0
-
- ;*******************************************************
-
- DCData5 dc.l window_ID ;Scanner Window Data Ptr
- dc.l 1 ;Transfer Count
- dc.l $00000000 ;Offset
- dc.l $00000000 ;Reserved
-
- dc.l $00000000 ;DCStop
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
-
- ;*******************************************************
-
- window_ID dc.b $01 ;Window Identifier
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #6
- ;
- ; This code segment issues a series of calls to the
- ; Apple Scanner by using the Apple SCSI Card Generic
- ; SCSI call ($2B). We first issue a GET DATA STATUS
- ; to see if there is enough data. Then we read in a
- ; single Scan Line with a READ Call. The data is then
- ; converted and placed in a video buffer.
- ;
- ;*******************************************************
-
- get_data
- stz scan_line ;Init the scanline to 0
- ;
- ; Issue the Call
- ;
- @get_data2 lda scan_dnum
- sta dev_num6
- sta dev_num65
-
- jsr call_card
- dc.b $04 ;Control Call Command Number
- dc.w cmd_list6
- bcs @out
- ;
- ; Is there enough Data?
- ; Enough data = 1 scan
- ; line of 4 inches at 75
- ; DPI or 300 pixels. At
- ; 8 pixels per byte, the
- ; data will be padded to
- ; 38 bytes.
- ;
- lda scan_data
- bne @have_line
- lda scan_data+1
- bne @have_line
- lda scan_data+2
- cmp #38 ;Decimal 38
- blt get_data
- ;
- ; We have the data. Read
- ; it.
- ;
- @have_line jsr call_card
- dc.b $04 ;Control Call Command Number
- dc.w cmd_list65
- bcs @out
- ;
- ; Now we need to invert
- ; the data.
- ;
- lda #40 ;40 bytes/line
- sta byte_count
- stz byte_index
- @loop_1 lda #$07
- sta seven ;Pixels/byte
- @loop_2 ldx #38-2
- asl raw_image+37;Shift bits out the top to
- @loop_3 rol raw_image,x ;the next byte 1 at a time
- dex
- bpl @loop_3
- ldx byte_index ;Shift the last bit in to
- ror screen,x ;this byte. This reverses the
- dec seven ;bit ordering. Also taking 8
- bne @loop_2 ;bits per byte down to 7
- lsr screen,x
- inc byte_index
- dec byte_count
- bne @loop_1
- ;
- ; Move data to Scan Line
- ;
- ldx scan_line
- jsr on_screen
- inc scan_line
- bra @get_data2
-
- @out lda #$00
- clc
- rts
-
- ;*******************************************************
-
- scan_line dc.b $00 ;Scan Line Index
- byte_count dc.b $00 ;Number of bytes left
- byte_index dc.b $00 ;Current Byte in use
- seven dc.b $00 ;Count off 7 pixels
- screen dcb.b 40,0 ;Place to do the screen
-
- ;*******************************************************
-
- cmd_list6 dc.b $03 ;PCount = 3
- dev_num6 dc.b $00 ;Device number
- dc.w gd_status ;Pointer to data
- dc.b $2B ;Control Code
-
- cmd_list65 dc.b $03 ;PCount = 3
- dev_num65 dc.b $00 ;Device number
- dc.w read ;Pointer to data
- dc.b $2B ;Control Code
-
- ;*******************************************************
-
- gd_status ;Our Data
- dc.w 24 ;Total Length of Parms
- dc.l get_stat ;CDB Pointer (Long)
- dc.l DCData6 ;DCMove Ptr (Long)
- dc.l $00000000 ;Rqst Sense Ptr (Long)
- dc.b $00 ;Reserved
- dc.b $00 ;SCSI Status
- dc.b $00 ;Command Count
- dc.l $0000000C ;Trans Count (Long)
- dc.b $00 ;DMA Mode
- dc.l $00000000 ;Reserved (Long)
-
- read ;Our Data
- dc.w 24 ;Total Length of Parms
- dc.l get_data2 ;CDB Pointer (Long)
- dc.l DCData65 ;DCMove Ptr (Long)
- dc.l $00000000 ;Rqst Sense Ptr (Long)
- dc.b $00 ;Reserved
- dc.b $00 ;SCSI Status
- dc.b $00 ;Command Count
- dc.l $00000026 ;Trans Count (Long)
- dc.b $00 ;DMA Mode
- dc.l $00000000 ;Reserved (Long)
-
- ;*******************************************************
-
- get_stat dc.b $34 ;GET DATA STATUS
- ;Parameters Command
- dcb.b 7,$00 ;Reserved
- dc.b 12 ;Transfer Length (Low)
- dc.b $00 ;Wait and Home Bits = 0
-
- get_data2 dc.b $28 ;READ
- ;Parameters Command
- dcb.b 4,$00 ;Reserved
- dc.b $01 ;Window ID
- dc.b $00 ;Transfer Length (High)
- dc.b $00 ;Transfer Length (Mid)
- dc.b $26 ;Transfer Length (Low)
- dc.b $00 ;Wait and Home Bits = 0
-
- ;*******************************************************
-
- DCData6 dc.l data_cnt ;Data Pointer
- dc.l 12 ;Transfer Count
- dc.l $00000000 ;Offset
- dc.l $00000000 ;Reserved
-
- dc.l $00000000 ;DCStop
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
-
- DCData65 dc.l raw_image ;Data Pointer
- dc.l 38 ;Transfer Count
- dc.l $00000000 ;Offset
- dc.l $00000000 ;Reserved
-
- dc.l $00000000 ;DCStop
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
- dc.l $00000000 ;Reserved
-
- ;*******************************************************
-
- data_cnt ;Data Space
- dcb.b 2,$00 ;Reserved
- dc.b $00 ;Data Length
- dc.b $00 ;Block
- dc.b $00 ;Window Identifier
- dcb.b 4,$00 ;Reserved
- scan_data dc.b $00 ;Scan Data (High)
- dc.b $00 ;Scan Data (Mid)
- dc.b $00 ;Scan Data (Low)
-
- raw_image dcb.b 38,$00 ;Scanned Data Image
-
- ;*******************************************************
-
- on_screen lda scan_tbl_lo,x
- sta <$42
- lda scan_tbl_hi,x
- sta <$43
- ldx #40-1
- ldy #40-1
- @loop lda screen,x
- eor #$7f
- sta ($42),y
- dex
- dey
- bpl @loop
-
- clc
- rts
-
- scan_tbl_lo dcb.b 8,$00 ;Lines 0-7
- dcb.b 8,$80 ;Lines 8-15
- dcb.b 8,$00 ;Lines 16-23
- dcb.b 8,$80 ;Lines 24-31
- dcb.b 8,$00 ;Lines 32-39
- dcb.b 8,$80 ;Lines 40-47
- dcb.b 8,$00 ;Lines 48-55
- dcb.b 8,$80 ;Lines 56-63
-
- dcb.b 8,$28 ;Lines 64-71
- dcb.b 8,$a8 ;Lines 72-79
- dcb.b 8,$28 ;Lines 80-87
- dcb.b 8,$a8 ;Lines 88-95
- dcb.b 8,$28 ;Lines 96-103
- dcb.b 8,$a8 ;Lines 104-111
- dcb.b 8,$28 ;Lines 112-119
- dcb.b 8,$a8 ;Lines 120-127
-
- dcb.b 8,$50 ;Lines 128-135
- dcb.b 8,$d0 ;Lines 136-143
- dcb.b 8,$50 ;Lines 144-151
- dcb.b 8,$d0 ;Lines 152-159
- dcb.b 8,$50 ;Lines 160-167
- dcb.b 8,$d0 ;Lines 168-175
- dcb.b 8,$50 ;Lines 176-183
- dcb.b 8,$d0 ;Lines 184-191
-
- scan_tbl_hi dc.b $20,$24,$28,$2c,$30,$34,$38,$3c
- dc.b $20,$24,$28,$2c,$30,$34,$38,$3c
- dc.b $21,$25,$29,$2d,$31,$35,$39,$3d
- dc.b $21,$25,$29,$2d,$31,$35,$39,$3d
- dc.b $22,$26,$2a,$2e,$32,$36,$3a,$3e
- dc.b $22,$26,$2a,$2e,$32,$36,$3a,$3e
- dc.b $23,$27,$2b,$2f,$33,$37,$3b,$3f
- dc.b $23,$27,$2b,$2f,$33,$37,$3b,$3f
-
- dc.b $20,$24,$28,$2c,$30,$34,$38,$3c
- dc.b $20,$24,$28,$2c,$30,$34,$38,$3c
- dc.b $21,$25,$29,$2d,$31,$35,$39,$3d
- dc.b $21,$25,$29,$2d,$31,$35,$39,$3d
- dc.b $22,$26,$2a,$2e,$32,$36,$3a,$3e
- dc.b $22,$26,$2a,$2e,$32,$36,$3a,$3e
- dc.b $23,$27,$2b,$2f,$33,$37,$3b,$3f
- dc.b $23,$27,$2b,$2f,$33,$37,$3b,$3f
-
- dc.b $20,$24,$28,$2c,$30,$34,$38,$3c
- dc.b $20,$24,$28,$2c,$30,$34,$38,$3c
- dc.b $21,$25,$29,$2d,$31,$35,$39,$3d
- dc.b $21,$25,$29,$2d,$31,$35,$39,$3d
- dc.b $22,$26,$2a,$2e,$32,$36,$3a,$3e
- dc.b $22,$26,$2a,$2e,$32,$36,$3a,$3e
- dc.b $23,$27,$2b,$2f,$33,$37,$3b,$3f
- dc.b $23,$27,$2b,$2f,$33,$37,$3b,$3f
-
- ;*******************************************************
- ;
- ; CODE SAMPLE #7
- ;
- ; This code segment toggles the HiRes Soft switches so
- ; that we can see what was just scanned.
- ;
- ;*******************************************************
-
- display
- ;
- ; Save the Current State
- ;
- lda RDTEXT
- sta @text ;Text/Graphics
-
- lda RDMIX
- sta @mixed ;Mixed?
-
- lda RDPAGE2
- sta @page ;Page 1 or 2
-
- lda RDHIRES
- sta @hires ;HiRes Mode?
-
- lda RD80COL
- sta @80col ;80-Column Mode?
-
- lda CLR80VID ;40-Column Mode.
- lda TXTCLR ;Standard Apple II Graphics
- lda MIXCLR ;Clear Mixed Mode
- lda TXTPAGE1 ;Page 1
- lda HIRES ;HiRes Mode
- lda CLRAN3 ;Clear annunciator 3
-
-
- sta KBD_STRB ;Clear Key Strobe
- @key_loop lda KBD ;Get key
- bpl @key_loop ;Wait for Key Press
- sta KBD_STRB ;Clear Key Strobe
- cmp #ESC ;ESC Key
- clc
- bne @chk_txt
- sec ;Exit on ESC
-
- lda SETAN3 ;Set annunciator 3
-
- @chk_txt lda @text
- bpl @chk_mix
- sta TXTSET ;Text on
-
- @chk_mix lda @mixed
- bpl @chk_page
- sta MIXSET ;Mixed on
-
- @chk_page lda @page
- bpl @chk_hires
- sta TXTPAGE2 ;Page 2
-
- @chk_hires lda @hires
- bpl @chk_40col
- sta LORES ;HiRes Off
-
- @chk_40col lda @80col
- bpl @rts
- sta SET80VID ;80-Column on.
-
- @rts rts
-
- @text dc.b $00
- @mixed dc.b $00
- @page dc.b $00
- @hires dc.b $00
- @80col dc.b $00
-
- ;*******************************************************
-
- ENDP
-
- END
-
-